Imports Microsoft.VisualBasic
Imports System.Data.Sql
Imports System.Data.SqlClient
Imports System
Imports System.Data
Imports GTSDAL
Imports GTSDALTableAdapters

Namespace GTSSystem.BLL
    <System.ComponentModel.DataObject()> _
Public Class Surcharge
        Private _SurchargeAdaptor As SurchargeTableAdapter = Nothing
        Private _RateSurchargeAdaptor As RateSurchargeTableAdapter = Nothing

        Protected ReadOnly Property SurchargeAdaptor() As SurchargeTableAdapter
            Get
                If _SurchargeAdaptor Is Nothing Then
                    _SurchargeAdaptor = New SurchargeTableAdapter
                End If
                Return _SurchargeAdaptor
            End Get
        End Property

        Protected ReadOnly Property RateSurchargeAdaptor() As RateSurchargeTableAdapter
            Get
                If _RateSurchargeAdaptor Is Nothing Then
                    _RateSurchargeAdaptor = New RateSurchargeTableAdapter
                End If
                Return _RateSurchargeAdaptor
            End Get
        End Property

        <System.ComponentModel.DataObjectMethod(ComponentModel.DataObjectMethodType.Select, True)> _
        Public Shared Function GetSurcharge() As SurchargeDataTable
            Try
                Dim SurchargeAdaptor As New GTSDALTableAdapters.SurchargeTableAdapter
                Return SurchargeAdaptor.GetSurcharge
            Catch ex As Exception
                Throw
            End Try
        End Function
        <System.ComponentModel.DataObjectMethod(ComponentModel.DataObjectMethodType.Select, True)> _
        Public Shared Function GetSurchargeByID(ByVal SurchargeID As Integer) As SurchargeDataTable
            Try
                Dim SurchargeAdaptor As New GTSDALTableAdapters.SurchargeTableAdapter
                Return SurchargeAdaptor.GetSurchargeByID(SurchargeID)
            Catch ex As Exception
                Throw
            End Try
        End Function
        <System.ComponentModel.DataObjectMethod(ComponentModel.DataObjectMethodType.Select, True)> _
        Public Function GetSurchargeByRateIDSurchargeID(ByVal RateID As Integer, ByVal SurchargeID As Integer) As RateSurchargeDataTable
            Try
                Return RateSurchargeAdaptor.GetSurchargeByRateIDSurchargeID(RateID, SurchargeID)
            Catch ex As Exception
                Throw
            End Try
        End Function
        <System.ComponentModel.DataObjectMethod(ComponentModel.DataObjectMethodType.Select, True)> _
        Public Function GetSurchargeByRateID(ByVal RateID As Integer) As RateSurchargeDataTable
            Try
                Return RateSurchargeAdaptor.GetRateSurchargeByRateID(RateID)
            Catch ex As Exception
                Throw
            End Try
        End Function
        <System.ComponentModel.DataObjectMethod(ComponentModel.DataObjectMethodType.Insert, True)> _
        Public Sub Insert(ByVal SurchargeID As Integer, _
                                        ByVal RateID As Integer, _
                                        ByVal ExtraCharge As Double, _
                                        ByVal ChargeType As String)
            Try
                RateSurchargeAdaptor.Insert(RateID, SurchargeID, ExtraCharge, ChargeType)
            Catch ex As Exception
                Throw
            End Try
        End Sub
        <System.ComponentModel.DataObjectMethod(ComponentModel.DataObjectMethodType.Update, True)> _
        Public Sub UpdateRateSurcharge(ByVal SurchargeID As Integer, _
                                        ByVal RateID As Integer, _
                                        ByVal ExtraCharge As Double, _
                                        ByVal ChargeType As String)
            Try
                RateSurchargeAdaptor.UpdateRateSurcharge(ExtraCharge, ChargeType, RateID, SurchargeID)
            Catch ex As Exception
                Throw
            End Try
        End Sub

    End Class
End Namespace
